package com.slh.touchandroid.utils;

import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;

import com.slh.touchandroid.R;
import com.slh.touchandroid.activity.DummyActivity;
import com.slh.touchandroid.receiver.DeviceAdminReceiver;

public class CONFIG {
	public static class MIMETYPE {
		// ZIP
		public static final String ZIP_7 = "application/x-7z-compressed";
		public static final String ZIP = "application/zip";
		public static final String RAR = "application/x-rar-compressed";
		// Video
		public static final String VIDEO = "video";
		public static final String FLV = "video/x-flv";
		public static final String WMV = "video/x-ms-wmv";
		public static final String MP4 = "video/mp4";
		public static final String AVI = "video/x-msvideo";
		// Audio
		public static final String AUDIO = "audio";
		public static final String WMA = "audio/x-ms-wma";
		// Image
		public static final String IMAGE = "image";
		public static final String JPG = "image/jpeg";
		public static final String GIF = "image/gif";
		public static final String PNG = "image/png";
		// APP
		public static final String BIN = "application/octet-stream";
		public static final String APK = "application/vnd.android.package-archive";
		public static final String BMP = "image/bmp";
		public static final String CSV = "text/csv";
		public static final String HTML = "text/html";
		public static final String JSON = "application/json";
		public static final String XML = "application/xml";
		public static final String PDF = "application/pdf";
		public static final String TXT = "text/plain";
		// OFFICE
		public static final String PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
		public static final String PPT = "application/vnd.ms-powerpoint";
		public static final String XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
		public static final String XLS = "application/vnd.ms-excel";
		public static final String DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.documen";
		public static final String DOC = "application/msword";

	}

	public static class BROADCAST {
		public static String ACTION_FAVORITE_APP_CHANGED = "com.slh.touchandroid.utils.BROADCAST.ACTION_FAVORITE_APP_CHANGED";
		public static String ACTION_MAIN_PANEL_CHANGED = "com.slh.touchandroid.utils.BROADCAST.ACTION_MAIN_PANEL_CHANGED";
		public static String ACTION_SUB_PANEL_CHANGED = "com.slh.touchandroid.utils.BROADCAST.ACTION_SUB_PANEL_CHANGED";
		public static String ACTION_FLOATING_ICON_SETTINFS = "com.slh.touchandroid.utils.BROADCAST.ACTION_FLOATING_ICON_SETTINFS";
		public static String ACTION_SHOW_ICON_ON_LOCK_SETTINFS = "com.slh.touchandroid.utils.BROADCAST.ACTION_SHOW_ICON_ON_LOCK_SETTINFS";
		public static String ACTION_FLOAT_ICON_RESOURCE_CHANGED = "com.slh.touchandroid.utils.BROADCAST.ACTION_FLOAT_ICON_CHANGED";

		public static String EXTRA_FLOATING_ICON_SETTINFS = "com.slh.touchandroid.utils.BROADCAST.EXTRA_FLOATING_ICON_SETTINFS";
		public static String EXTRA_SHOW_ICON_ON_LOCK_SETTINFS = "com.slh.touchandroid.utils.BROADCAST.EXTRA_SHOW_ICON_ON_LOCK_SETTINFS";
		public static String EXTRA_FLOAT_ICON_RESOURCE = "com.slh.touchandroid.utils.BROADCAST.EXTRA_FLOAT_ICON_RESOURCE";
	}

	public static class FEEDBACK {
		public static String EMAIL = "miracleSTek@gmail.com";
		public static String SUBJECT = "Android Touch";
	}

	public static class ADMIN_DEVICE {
		public static void removeDeviceAdmin(Context context) {
			DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context
					.getSystemService(Context.DEVICE_POLICY_SERVICE);
			ComponentName compName = new ComponentName(context,
					DeviceAdminReceiver.class);
			if (devicePolicyManager.isAdminActive(compName)) {
				devicePolicyManager.removeActiveAdmin(compName);
				return;
			}
		}

		public static boolean isDeviceAdmin(Context context) {
			DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context
					.getSystemService(Context.DEVICE_POLICY_SERVICE);
			ComponentName compName = new ComponentName(context,
					DeviceAdminReceiver.class);
			return devicePolicyManager.isAdminActive(compName);
		}

		public static void addDeviceAdmin(Context context) {
			DummyActivity.start(context, DummyActivity.ACTION_ADD_DEVICE);
		}

		public static void toggleDeviceAdmin(Context context, boolean value) {
			if (value) {
				addDeviceAdmin(context);
			} else {
				removeDeviceAdmin(context);
			}
		}

	}

	public static class FLOAT_ICON {
		public static int getFloatIcon(Context context) {
			return SharePreferenceUtils.getPrefInt(context,
					context.getString(R.string.key_float_icon),
					R.drawable.ic_android0);
		}

		public static void setFloatIcon(Context context, int resId) {
			SharePreferenceUtils.putPrefInt(context,
					context.getString(R.string.key_float_icon),

					resId);
		}
	}
}
